/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 工具栏样式 */
.toolbar {
    background: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.btn-primary {
    background-color: #007bff;
    color: white;
}

.btn-primary:hover {
    background-color: #0056b3;
}

.btn-danger {
    background-color: #dc3545;
    color: white;
}

.btn-danger:hover {
    background-color: #c82333;
}

.sort-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sort-controls label {
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

.sort-controls select {
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background-color: white;
    cursor: pointer;
}

/* 主要内容区域 */
.main-content {
    display: grid;
    grid-template-columns: 300px 1fr 400px;
    gap: 20px;
    flex: 1;
    overflow: hidden;
}

/* 侧边栏样式 */
.sidebar {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.keyword-section {
    flex: 1;
    padding: 20px;
    border-bottom: 1px solid #eee;
    overflow-y: auto;
}

.selected-keywords-section {
    padding: 20px;
    max-height: 200px;
    overflow-y: auto;
}

.sidebar h3 {
    margin-bottom: 15px;
    color: #333;
    font-size: 16px;
    font-weight: 600;
}

/* 关键词树样式 */
.keyword-tree {
    font-size: 14px;
}

.keyword-item {
    padding: 6px 12px;
    margin: 2px 0;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
    user-select: none;
}

.keyword-item:hover {
    background-color: #f8f9fa;
}

.keyword-item.selected {
    background-color: #007bff;
    color: white;
}

.keyword-children {
    margin-left: 20px;
    border-left: 1px solid #eee;
    padding-left: 10px;
}

/* 已选关键词样式 */
.selected-keywords {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.selected-keyword {
    background-color: #007bff;
    color: white;
    padding: 4px 8px;
    border-radius: 16px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s ease;
}

.selected-keyword:hover {
    background-color: #0056b3;
}

.remove-btn {
    font-weight: bold;
    margin-left: 4px;
}

/* 文章列表样式 */
.article-list {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.list-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.list-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.article-count {
    font-size: 14px;
    color: #666;
}

.article-items {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0;
}

.article-item {
    padding: 15px 20px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: all 0.2s ease;
}

.article-item:hover {
    background-color: #f8f9fa;
}

.article-item.selected {
    background-color: #e3f2fd;
    border-left: 4px solid #007bff;
}

.article-title {
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    font-size: 16px;
    line-height: 1.4;
}

.article-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    color: #666;
    margin-bottom: 8px;
}

.article-author {
    font-weight: 500;
}

.article-date {
    color: #999;
}

.article-score {
    background-color: #28a745;
    color: white;
    padding: 2px 6px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.article-keywords {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 8px;
}

.keyword-tag {
    background-color: #e9ecef;
    color: #495057;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 11px;
}

/* 文章详情样式 */
.article-detail {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow: hidden;
}

.detail-content {
    padding: 20px;
    height: 100%;
    overflow-y: auto;
}

.no-selection {
    text-align: center;
    color: #999;
    font-style: italic;
    margin-top: 50px;
}

.detail-header {
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.detail-title {
    font-size: 20px;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
    line-height: 1.4;
}

.detail-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    font-size: 14px;
    color: #666;
}

.detail-section {
    margin-bottom: 20px;
}

.detail-section h4 {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
}

.detail-abstract {
    line-height: 1.6;
    color: #555;
    text-align: justify;
}

.detail-keywords {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.detail-keyword {
    background-color: #007bff;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
}

.detail-actions {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
}

/* 加载状态 */
.loading {
    text-align: center;
    padding: 40px;
    color: #999;
    font-style: italic;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .main-content {
        grid-template-columns: 250px 1fr 350px;
    }
}

@media (max-width: 992px) {
    .main-content {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto 1fr;
    }
    
    .sidebar {
        flex-direction: row;
        height: auto;
    }
    
    .keyword-section,
    .selected-keywords-section {
        flex: 1;
        border-bottom: none;
        border-right: 1px solid #eee;
    }
    
    .selected-keywords-section {
        border-right: none;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .toolbar {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
    
    .sidebar {
        flex-direction: column;
    }
    
    .keyword-section,
    .selected-keywords-section {
        border-right: none;
        border-bottom: 1px solid #eee;
    }
}